Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

280
Vistas
Getting error PodSpec.containers: got "map", expected "array" or Container.volumeMounts: got "map", expected "array";

I am trying to start a deployment but I am getting this error

error: error validating "httpd-basic-deployment.yaml": error validating data: ValidationError(Deployment.spec.template.spec.containers): invalid type for io.k8s.api.core.v1.PodSpec.containers: got "map", expected "array"; if you choose to ignore these errors, turn validation off with --validate=false

of the below pod definition file:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ebay-app
spec:
  selector:
    matchLabels:
        environment: dev
        app: ebay
  replicas: 1
  template:
    metadata:
      labels:
        environment: dev
        app: ebay
    spec:

      volumes:
        - name: volume
          hostPath:
            path: /mnt/data

      containers:
        name: container1-nginx
        image: nginx
        volumeMounts:
           name: volume
           mountPath: /var/nginx-data

        name: container2-tomcat
        image: tomcat
      nodeSelector:
        boardType: x86vm

I tried listing the cotnainers again:

 volumes:
    - name: volume
      hostPath:
        path: /mnt/data

  containers:
    - name: container1-nginx
      image: nginx
      volumeMounts:
         name: volume
         mountPath: /var/nginx-data
    
    - name: container2-tomcat
      image: tomcat

  nodeSelector:
    boardType: x86vm

that results in different error

error: error validating "httpd-basic-deployment.yaml": error validating data: ValidationError(Deployment.spec.template.spec.containers[0].volumeMounts): invalid type for io.k8s.api.core.v1.Container.volumeMounts: got "map", expected "array"; if you choose to ignore these errors, turn validation off with --validate=false

what am i doing wrong ?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

VolumeMounts should also have -. It indicates start of an array. Change it as shown below.

volumeMounts:
- name: volume
  mountPath: /var/nginx-data

Have a look at this example yaml to create pod that has two containers and shares same volume. In this example, its clear where to use - symbol and where not.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda